package com.jt.www.domain.enums.common;

import org.apache.commons.lang3.StringUtils;

/**
 * 文件资源中标识的文件类型
 * Created by shaoyn on 2020/04/28.
 */
public enum BusinessTypeCodeEnum {

    S001("S001", "隐患排查图片/报告"),
    I001("I001", "企业证件类（三证合一）"),
    A001("A001", "投保单影印件"),
    A002("A002", "电子保单、保单影印件"),
    A003("A003", "回执单影印件"),
    A004("A004", "批单影印件"),
    A005("A005", "盖章扫描件"),
    P001("P001", "电子发票"),
    P002("P002", "延期支付凭证"),
    P003("P003", "付款凭证"),
    P005("P005", "纸质发票影印件"),
    A101("A101", "标的清单"),
    L001("L001", "被保人清单"),
    F001("F001", "线下录入保单文件"),
    F002("F002", "线下录入保单附件"),
    F003("F003", "线下批单录入附件"),
    X001("X001", "经纪服务委托协议"),
    F004("F004","保单佐证文件"),
    F005("F005","批单佐证文件");

    private String code;
    private String desc;

    BusinessTypeCodeEnum(String code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 通过code返回 枚举对象
     *
     * @param code
     * @return
     */
    public static BusinessTypeCodeEnum getEnumByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }
        for (BusinessTypeCodeEnum businessTypeCodeEnum : BusinessTypeCodeEnum.values()) {
            if (businessTypeCodeEnum.code.equals(code)) {
                return businessTypeCodeEnum;
            }
        }
        return null;
    }


    public String getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }
}
